package com.leyou.sms.config;

import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.profile.DefaultProfile;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * <h3>leyou-project</h3>
 * <p></p>
 *
 * @author : hhw
 * @date : 2020-06-04 20:25
 **/

@Configuration
//指定类实例化
@EnableConfigurationProperties(value = SmsProperties.class)
public class SmsConfig {

    @Bean
    public IAcsClient getIAcsClient(SmsProperties prop) {
        return new DefaultAcsClient(DefaultProfile.getProfile(prop.getRegionID(), prop.getAccessKeyID(), prop.getAccessKeySecret()));
    }

}
